package com.yutel.comp.queue;

public class QueueLog {
	private String name;
	private boolean debug = false;
	private static QueueLog instance = null;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public QueueLog(String name) {
		this.name = name;
	}

	public static QueueLog getLogger(Class<?> clz) {
		instance = new QueueLog(clz.getCanonicalName());
		return instance;
	}

	public void setDebug(boolean debug) {
		this.debug = debug;
	}

	public boolean isDebugEnabled() {
		return debug;
	}

	public void debug(Object msg) {
		System.out.println("[DEBUG] | " + instance.getName() + " | " + msg);
	}

	public void info(Object msg) {
		System.err.println("[INFO] | " + instance.getName() + " | " + msg);
	}

	public void warn(Object msg) {
		System.err.println("[WARN] | " + instance.getName() + " | " + msg);
	}

	public void warn(Object msg, Throwable e) {
		System.err.println("[WARN] | " + instance.getName() + " | " + msg
				+ e.getMessage());
	}

	public void error(Object msg) {
		System.err.println("[ERROR] | " + instance.getName() + " | " + msg);
	}

	public void error(Object msg, Throwable e) {
		System.err.println("[ERROR] | " + instance.getName() + " | " + msg
				+ e.getMessage());
	}
}
